/**
 *
 */
var Wysiwyg = {

    _types: {
        fckeditor: function(name) {
            var editor = new FCKeditor(name);
            editor.Height = '500';
            editor.BasePath = 'scripts/wysiwyg/fckeditor/';
            editor.ReplaceTextarea();
        },

        tinymce: function(name) {
            tinyMCE.init({

                // General options
                mode  : 'exact',
                theme : 'advanced',
                width : '100%',
                height: '300px',
                elements: name,

                // Theme options
                theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,|,bullist,numlist,blockquote,|,link,unlink,image,|,cleanup,code,preview',
                theme_advanced_buttons2 : '',
                theme_advanced_buttons3 : '',

                // Allowed tags
                valid_elements : 'a[href|target],strong/b,br,img[src|style],em/i,ul,ol,li,p[class|style],span[class|style],u,del/s,ins,h1,h2,h3,h4,h5,h6,code,pre,abbr,blockquote',

                relative_urls : true,
                remove_script_host : false,
                force_p_newlines : true,
                force_br_newlines : false,
                convert_newlines_to_brs : false,
                remove_linebreaks : false,
                disk_cache : true,

                theme_advanced_toolbar_location : 'top',
                theme_advanced_toolbar_align : 'left',
                theme_advanced_statusbar_location : 'bottom',
                theme_advanced_resizing : true,
                theme_advanced_resize_horizontal : false
            });
        }
    },

    create: function(type, name) {
        if (type in Wysiwyg._types) {
            new Wysiwyg._types[type](name);
        } else {
            alert('Unsupported WYSIWYG type "' + type + '"');
        }
    }
};
